<?php
    require('inc/header.php');
    $user = TheUser::getInstance();
    $controller = Router::getController();
    $action = Router::getAction();
    //object = {js, stylesheet, module, getView()}
    $view = $controller->$action(Router::getParams());
    
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="stylesheet.css" type="text/css" rel="stylesheet">
        <script type="text/javascript" language="javascript" src="inc/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" language="javascript" src="inc/countDown.js"></script>
        <?php
            if($view->getModule() !== false) { //FALSE == MAIN PAGE
                foreach($view->getCss() as $key => $file) {
                    echo '<link href="modules/' . $view->getModule()->getDir() . '/' . $file . '" type="text/css" rel="stylesheet">'; 
                }
                foreach($view->getJs() as $key => $file) {
                    echo '<script type="text/javascript" language="javascript" src="modules/' . $view->getModule()->getDir() . '/' . $file . '"></script>';
                }
            }
        ?>
        <title>WTCS</title>
    </head>
    <body>
        <h1 style="width: 860px; display: inline-block;">Zalogowany jako: <?php echo $user->getName() . ' ' . $user->getSurname() . ' (' . $user->getLogin()  . ')'; ?></h1><h1 id="timeleft" style="display: inline-block; width: 100px; text-align: right;"></h1>
        <hr />
        <?php
            print $view->getView();
        ?>
    </body>
</html>
